#pragma once
#include "ZuiLib.h"
#include "LRefObject.h"
#include "LUtils.h"

namespace ZuiLib {

class LLabel :public LRefObject<ZLabel>
{
public:
	int getTextStyle(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetTextStyle());
	}

	int setTextStyle(LuaFuncState& L)
	{
		pThis->SetTextStyle(L.arg(0).toUInt());
		return 0;
	}

	int getTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetTextColor());
	}

	int setTextColor(LuaFuncState& L)
	{
		pThis->SetTextColor(toColor(L.arg(0)));
		return 0;
	}

	int getDisabledTextColor(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetDisabledTextColor());
	}

	int setDisabledTextColor(LuaFuncState& L)
	{
		pThis->SetDisabledTextColor(toColor(L.arg(0)));
		return 0;
	}

	int getFontName(LuaFuncState& L)
	{
		return L.lreturn(pThis->GetFontName());
	}

	int setFontName(LuaFuncState& L)
	{
		pThis->SetFontName(L.arg(0).toString());
		return 0;
	}

	int getTextPadding(LuaFuncState& L)
	{
		return L.lreturn(toLua(&L,pThis->GetTextPadding()));
	}

	int setTextPadding(LuaFuncState& L)
	{
		pThis->SetTextPadding(toRect(L.arg(0)));
		return 0;
	}

	int isAutoWidth(LuaFuncState& L)
	{
		return L.lreturn(pThis->IsAutoWidth());
	}

	int setAutoWidth(LuaFuncState& L)
	{
		pThis->SetAutoWidth(L.arg(0).toBool());
		return 0;
	}


	BEGIN_MAP_FUNC(LLabel)
	DECLARE_FUNC(getTextStyle),
	DECLARE_FUNC(setTextStyle),

	DECLARE_FUNC(getTextColor),
	DECLARE_FUNC(setTextColor),
	DECLARE_FUNC(getDisabledTextColor),
	DECLARE_FUNC(setDisabledTextColor),
	DECLARE_FUNC(getFontName),
	DECLARE_FUNC(setFontName),
	DECLARE_FUNC(getTextPadding),
	DECLARE_FUNC(setTextPadding),
	DECLARE_FUNC(isAutoWidth),
	DECLARE_FUNC(setAutoWidth),
	END_MAP_FUNC


	BEGIN_MAP_CONST
	DECLARE_CONST("DT_TOP", DT_TOP),
	DECLARE_CONST("DT_LEFT", DT_LEFT),
	DECLARE_CONST("DT_CENTER", DT_CENTER),
	DECLARE_CONST("DT_RIGHT", DT_RIGHT),
	DECLARE_CONST("DT_VCENTER", DT_VCENTER),
	DECLARE_CONST("DT_BOTTOM", DT_BOTTOM),
	DECLARE_CONST("DT_END_ELLIPSIS", DT_END_ELLIPSIS),
	END_MAP_CONST
};

}//namespace

